package error

//超出时间限制
func maxArea(height []int) int {
	//先采用暴力方法
	result := 0
	for i := 0; i < len(height); i++ {
		leftHeight := height[i]
		for j := i + 1; j < len(height); j++ {
			result = max(result, min(leftHeight, height[j])*(j-i))
		}
	}
	return result
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
